package com.xrui.hbase;

import com.google.common.base.Function;
import org.apache.avro.Schema;

import java.io.IOException;

public interface AvroSchemaResolver extends Function<String, Schema> {
    /**
     * Resolves an Avro schema descriptor into a Schema object.
     *
     * @param avroSchemaId Avro schema descriptor to resolve.
     * @return the resolved Schema object.
     */
    @Override
    Schema apply(String avroSchemaId);

    /**
     * Caches or reloads all of the avro schemas.
     *
     * @throws IOException when cache or reload avro schemas failed
     */
    void cache() throws IOException;
}
